package com.dup.jxlh.admin.controller;

import com.dup.jxlh.admin.entities.model.ChapterApply;
import com.dup.jxlh.admin.service.ChapterApplyService;
import com.dup.jxlh.api.entities.CommonResult;
import com.dup.jxlh.api.entities.PaginationData;
import com.dup.jxlh.api.enums.ResultEnum;
import com.dup.jxlh.api.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/chapter")
@Validated
public class ChapterApplyController {
    @Autowired
    private ChapterApplyService chapterApplyService;

    @PostMapping("/getChapterApplyList")
    @PreAuthorize("hasAnyAuthority('ROLE_Admin','ROLE_Chapter_Show')")
    public CommonResult getChapterApplyList(PaginationData paginationData, @Validated ChapterApply chapterApply) {
        return ResultUtil.result(ResultEnum.SUCCESS, chapterApplyService.getChapterApplyList(paginationData, chapterApply));
    }
}
